/**
 * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.lywz.core.dao;

import java.io.Serializable;
import java.sql.Connection;

import org.hibernate.CacheMode;
import org.hibernate.Criteria;
import org.hibernate.EntityMode;
import org.hibernate.Filter;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.ReplicationMode;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.jdbc.Work;
import org.hibernate.stat.SessionStatistics;

public interface LYWZSession {

	public Session getHibernateSession();

	public Transaction beginTransaction() throws HibernateException;

	public void cancelQuery() throws HibernateException;

	public void clear();

	public Connection close() throws HibernateException;

	public boolean contains(Object object);

	public <T> Criteria createCriteria(Class<T> persistentClass);

	public <T> Criteria createCriteria(Class<T> persistentClass, String alias);

	public Criteria createCriteria(String entityName);

	public Criteria createCriteria(String entityName, String alias);

	public Query createFilter(Object collection, String queryString) throws HibernateException;

	public Query createQuery(String queryString) throws HibernateException;

	public SQLQuery createSQLQuery(String queryString) throws HibernateException;

	public void delete(Object object) throws HibernateException;

	public void delete(String entityName, Object object) throws HibernateException;

	public void disableFilter(String filterName);

	public Connection disconnect() throws HibernateException;

	public void doWork(Work work) throws HibernateException;

	public Filter enableFilter(String filterName);

	public void evict(Object object) throws HibernateException;

	public void flush() throws Exception;

	public <T> T get(Class<T> clazz, Serializable id) throws HibernateException;

	public <T> T get(Class<T> clazz, Serializable id, LockMode lockMode) throws HibernateException;

	public <T> T get(String entityName, Serializable id) throws HibernateException;

	public <T> T get(String entityName, Serializable id, LockMode lockMode) throws HibernateException;

	public CacheMode getCacheMode();

	public LockMode getCurrentLockMode(Object object) throws HibernateException;

	public Filter getEnabledFilter(String filterName);

	public EntityMode getEntityMode();

	public String getEntityName(Object object) throws HibernateException;

	public FlushMode getFlushMode();

	public Serializable getIdentifier(Object object) throws HibernateException;

	public Query getNamedQuery(String queryName) throws HibernateException;

	public Session getSession(EntityMode entityMode);

	public SessionFactory getSessionFactory();

	public SessionStatistics getStatistics();

	public Transaction getTransaction();

	public boolean isConnected();

	public boolean isDirty() throws HibernateException;

	public boolean isOpen();

	public <T> T load(Class<T> theClass, Serializable id, LockMode lockMode) throws HibernateException;

	public <T> T load(String entityName, Serializable id, LockMode lockMode) throws HibernateException;

	public <T> T load(Class<T> theClass, Serializable id) throws HibernateException;

	public <T> T load(String entityName, Serializable id) throws HibernateException;

	public void load(Object object, Serializable id) throws HibernateException;

	public void lock(Object object, LockMode lockMode) throws HibernateException;

	public void lock(String entityName, Object object, LockMode lockMode) throws HibernateException;

	public <T> T merge(Object object) throws HibernateException;

	public <T> T merge(String entityName, Object object) throws HibernateException;

	public void persist(Object object) throws HibernateException;

	public void persist(String entityName, Object object) throws HibernateException;

	/**
	 * @deprecated
	 */
	public void reconnect() throws HibernateException;

	public void reconnect(Connection connection) throws HibernateException;

	public void refresh(Object object) throws HibernateException;

	public void refresh(Object object, LockMode lockMode) throws HibernateException;

	public void replicate(Object object, ReplicationMode replicationMode) throws HibernateException;

	public void replicate(String entityName, Object object, ReplicationMode replicationMode) throws HibernateException;

	public Serializable save(Object object) throws HibernateException;

	public Serializable save(String entityName, Object object) throws HibernateException;

	public void saveOrUpdate(Object object) throws HibernateException;

	public void saveOrUpdate(String entityName, Object object) throws HibernateException;

	public void setCacheMode(CacheMode cacheMode);

	public void setFlushMode(FlushMode flushMode);

	public void setReadOnly(Object entity, boolean readOnly);

	public void update(Object object) throws HibernateException;

	public void update(String entityName, Object object) throws HibernateException;

	public Connection connect();
}
